package com.bwie.remote.factory;

import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import com.bwie.remote.RemoteSystemService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @className: RemoteSystemServiceFallback
 * @Description: TODO
 * @version: v1.８.0
 * @author: 李明
 * @date: 2025/10/22 10:13
 */
@Component
public class RemoteSystemServiceFallback implements FallbackFactory<RemoteSystemService> {
    @Override
    public RemoteSystemService create(Throwable cause) {
        return new RemoteSystemService() {
            @Override
            public Result<User> getUserInfo(String username) {
                return Result.error("该服务器已断开，请稍后再试...");
            }

            /**
             * 根据手机号查询用户信息
             *
             * @param phone
             */
            @Override
            public Result<User> getUserByPhone(String phone) {
                return Result.error("该服务器已断开，请稍后再试...");
            }

            /**
             * 注册用户
             *
             * @param user
             */
            @Override
            public Result addUserInfo(User user) {
                return Result.error("该服务器已断开，请稍后再试...");
            }
        };
    }
}
